;/*
; *	startup.s  --   startup file for swi
; *	
; *	Author: 	li ming <admin@lumit.org>
; *	Date:		2004-8-26
; *	Copyleft:	http://www.lumit.org
; */

	AREA asm_code, CODE

; *********************************************************************	

	IMPORT __main
    EXPORT  ENTRY 

	 
ENTRY

; **********************************************************************
; * Jump to the address of the C entry point.
; **********************************************************************
	b	__main
	
	IMPORT  do_swi
	EXPORT  swi_handler
swi_handler
	STMFD	sp!, {r0-r12, lr}        ; push r0-r12 register file and lr( pc return address )
	LDR 	r0, [lr,#-4]
	BIC	r0, r0,#0xff000000
	
	BL	do_swi					 ; goto C handler
	
	LDMFD	sp!, {r0-r12, pc}        ; recover r0-r12 and pc from stack, cpsr also
	
	END

; **********************************************************************
; * END OF startup.s
; **********************************************************************
